home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / World_Atlas_1.adf / REXX / Tutor.wa < prev   
Text File  |  1991-09-25  |  4KB  |  176 lines

  1.  
  2. /*
  3.     World Atlas V2.50b - AREXX Script (tutor example)
  4.     Written By Henrik Brinch
  5.  
  6.     This is ONLY a very simple (but not less useable) example
  7.     of how you can use "World Atlas" as a tutor.
  8.     You could make a more powerfull program, with ie. maps, and
  9.     all the countries of the world.
  10. */
  11.  
  12. address 'atlas'
  13. options results
  14.  
  15. numquestions = 0
  16. wb2front
  17. say
  18. say "   *************************************************************"
  19. say "   *                                                           *"
  20. say '   *             Welcome to the "World Of Questions"           *' 
  21. say "   *                                                           *"
  22. say "   *        Simple example of how you can use World Atlas      *"
  23. say "   *                  as a tutor in geography                  *"
  24. say "   *                                                           *"
  25. say "   *           AREXX script written by Henrik Brinch           *"
  26. say "   *                                                           *"
  27. say "   *************************************************************"
  28. say
  29. say "      Please highlight this window by clicking inside of it!"
  30. say
  31. say
  32.  
  33. /*  This line is neccesarry as we might be on the map for Europe
  34.     and we load in information about USA (Changing the data).
  35.     Then when we click on a country, we might get the name of the
  36.     state
  37. */
  38.  
  39. suspend
  40.  
  41.  
  42. do while numquestions < 1
  43.     say
  44.     say "                How many questions do you want ?"
  45.     pull numquestions
  46. end
  47.  
  48. oks = 1
  49. good = 0
  50. rgood = 0
  51.  
  52. do i=1 to numquestions
  53.     makeseed
  54.     con  = random(1,50,result)
  55.     num2con 1 con
  56.     state = result
  57.     capital 1 con
  58.     cap = upper(result)
  59.     answer = ""
  60.     done = 0
  61.  
  62.     do while done == 0
  63.         say
  64.         say "Question number "i" out of "numquestions" - (try number "oks")"
  65.         say "------------------------------------------------------------"
  66.         say "What is the capital of "state" ?"
  67.         pull answer
  68.  
  69.         if answer ~= cap then do
  70.             say
  71.             say " @!$#@$ WRONG %$#@!#"
  72.             oks = oks+1
  73.             if oks = 4 then do
  74.                 say
  75.                 if i ~= numquestions then say "You really don't remember?"
  76.                 say "The capital of "state" is "cap" (better luck next time!)"
  77.                 say
  78.                 done = 2
  79.                 oks = 1
  80.             end
  81.         end
  82.  
  83.         if done = 0 then do
  84.             if answer == cap then done = 1
  85.         end
  86.     end
  87.  
  88.     if done == 1 then do
  89.         say
  90.         say " -= CORRECT -="
  91.         if oks == 1 then do
  92.             rgood = rgood+1
  93.             good = good+1
  94.         end
  95.         if oks ~= 1 then good = good+1
  96.     end
  97.  
  98. end
  99.  
  100. say
  101. say "You only wanted "numquestions" questions, so we're finished"
  102. say
  103. say "============================================================"
  104. say "Here are some statistics about your answers :"
  105. say "============================================================"
  106.  
  107. if good == 0 then do
  108.     say "SHAME ON YOU!!!"
  109.     say
  110.     say "You didn't answer ANY question right..."
  111.     say "May I suggest some training?!"
  112.     say
  113. end
  114.  
  115. if good > 0 then do
  116.     say "You answered "good" out of "numquestions" questions right!"
  117.     say "You answered "rgood" questions right at first try"
  118.     calc = (good/numquestions)*100
  119.  
  120.     say "Percent of questions answered "calc"%"
  121.     say
  122.     say "     RATING :"
  123.     say
  124.  
  125.     if calc < 5 then do
  126.         say "     Not very nice!  Keep training!"
  127.         say
  128.         call bye
  129.     end
  130.     if calc < 10 then do
  131.         say "     Hmmm please don't brag!"
  132.         say
  133.         call bye
  134.     end
  135.     if calc < 20 then do
  136.         say "     Now we're getting somewhere eh'?"
  137.         say
  138.         call bye
  139.     end
  140.     if calc < 40 then do
  141.         say "     If you can do "calc"% you can also do 60%!"
  142.         say
  143.         call bye
  144.     end
  145.     if calc < 60 then do
  146.         say "     Do you know you only needed "100-calc"% before you had"
  147.         say "     answered all question... next time do 100% right?"
  148.         say
  149.         call bye
  150.     end
  151.     if calc < 80 then do
  152.         say "     Keep going, and you just might be get to be a pro?"
  153.         say
  154.         call bye
  155.     end
  156.     if calc == 100 then do
  157.         say "     I'm amazed you're really a pro' !!!"
  158.         say
  159.         call bye
  160.     end
  161. end
  162.  
  163. /*  Remember to release the suspended World Atlas... clever thing to do!
  164.     These two lines should be in any program, that might change
  165.     the data version!
  166. */
  167.  
  168.  
  169. bye:
  170.  
  171.     release
  172.     select_menu
  173.     delay 50*5   /*  Make a delay for 5 sec. so we can see the result */
  174.     wa2front
  175.     exit
  176.